home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
TASEXAM6.ARJ
/
MISSDATE.TAS
< prev
next >
Wrap
Text File
|
1991-05-05
|
3KB
|
67 lines
{ MISSDATE.TAS
Script to find "missing" dates in a ticker file.
This script will scan the dates in the ticker and point out
invalid dates (like Saturdays and Sundays). It will also
check the weekdays for "consecutiveness". In other words,
a Friday follows a Thursday etc. If it finds a "gap", it
checks the date missing against a list of holidays (which
are probably wrong, since I didn't save my old daytimers).
}
#output_file 'missdate.lst'
i : number;
day1 = daywk(dates[1]); { get first day in file}
i = 2; { start with second day}
:loop
if i > quote_count then return; { are we done?}
day2 = daywk(dates[i]); { pick up the day of the week}
if day2 < 1 or day2 > 5 then { is it Sunday or Saturday ?}
begin
if day2 = 0 then
badday = 'Sunday'
else
badday = 'Saturday';
writeln(ticker,datestr(dates[i]),' is a ',badday,'!');
end
else
if day1 = 5 and day2 = 1 then goto nextone; { Friday precedes Monday}
day1 = day1 + 1; { see what next day SHOULD be}
if day2 = day1 then goto nextone; { Compare to WHAT IT IS}
dayd1 = dates[i-1]; { Not what it should be..get full date}
dayd2 = dates[i]; { ditto}
{ Now this next part is how you could do a "holiday" check..
because the date you are comparing against is bigger than
32,767 which is the maximum number we can specify without a
decimal point, we need to make the number a "big" number by
adding a decimal zero.
The following if statements are just checking that the missing
day is one of the holidays for the last two years. As I said
above, I might have left a few out...if you fill them in, please
send the script back to me with as many as you can put in.
}
if dayd1 < 890101.0 and dayd2 > 890101.0 then goto nextone; { nyears 89}
if dayd1 < 890529.0 and dayd2 > 890529.0 then goto nextone; { mem day 89}
if dayd1 < 890704.0 and dayd2 > 890704.0 then goto nextone; { 4th jul 89}
if dayd1 < 890904.0 and dayd2 > 890904.0 then goto nextone; { lab day 89}
if dayd1 < 891123.0 and dayd2 > 891123.0 then goto nextone; { gobble 89}
if dayd1 < 891225.0 and dayd2 > 891225.0 then goto nextone; { xmax 89}
if dayd1 < 900101.0 and dayd2 > 900101.0 then goto nextone; { nyears 90}
if dayd1 < 900212.0 and dayd2 > 900212.0 then goto nextone; { pres 90}
if dayd1 < 900101.0 and dayd2 > 900101.0 then goto nextone; { nyears 90}
if dayd1 < 900704.0 and dayd2 > 900704.0 then goto nextone; { 4th jul 90}
if dayd1 < 900903.0 and dayd2 > 900903.0 then goto nextone; { lab day 90}
if dayd1 < 901122.0 and dayd2 > 901122.0 then goto nextone; { gobble 90}
if dayd1 < 901225.0 and dayd2 > 901225.0 then goto nextone; { xmax 90}
if dayd1 < 910101.0 and dayd2 > 910101.0 then goto nextone; { nyears 90}
if dayd1 < 910218.0 and dayd2 > 910218.0 then goto nextone; { pres 90}
days1 = datestr(dayd1); { make the prior date readable}
days2 = datestr(dayd2); { make the current date readable}
writeln(ticker,' is missing date between ',days1,' and ',days2);
:nextone { LABEL for getting next day}
day1 = day2; { make the current day into the prior day}
i = i+1; { move on to the next day}
goto loop; { and go do it again..what else?}